﻿using System;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using QzgfFrame.Controllers.System.RoleManger;
using QzgfFrame.System.RoleManger.Domain;
using QzgfFrame.System.RoleManger.Models;
using QzgfFrame.Webservice.Models;

namespace QzgfFrame.Mvc3.Tests
{
    
    
    /// <summary>
    ///这是 RoleControllerTest 的测试类，旨在
    ///包含所有 RoleControllerTest 单元测试
    ///</summary>
    [TestClass()]
    public class RoleControllerTest : AppBase
    {

        private RoleController roleController;
        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试特性
        // 
        //编写测试时，还可使用以下特性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///RoleController 构造函数 的测试
        ///</summary>
        [TestMethod()]
        public void RoleControllerConstructorTest()
        {
            RoleController target = new RoleController();
            Assert.Inconclusive("TODO: 实现用来验证目标的代码");
        }

        /// <summary>
        ///Delete 的测试
        ///</summary>
        [TestMethod()]
        public void DeleteTest()
        {
            RoleController target = new RoleController(); // TODO: 初始化为适当的值
            string id = string.Empty; // TODO: 初始化为适当的值
            ActionResult expected = null; // TODO: 初始化为适当的值
            ActionResult actual;
            actual = target.Delete(id);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///Edit 的测试
        ///</summary>
        [TestMethod()]
        public void EditTest()
        {
            RoleController target = new RoleController(); // TODO: 初始化为适当的值
            string id = string.Empty; // TODO: 初始化为适当的值
            SystemRole entity = null; // TODO: 初始化为适当的值
            ActionResult expected = null; // TODO: 初始化为适当的值
            ActionResult actual;
            actual = target.Edit(id, entity);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///Edit 的测试
        ///</summary>
        [TestMethod()]
        public void EditTest1()
        {
            RoleController target = new RoleController(); // TODO: 初始化为适当的值
            string id = string.Empty; // TODO: 初始化为适当的值
            ActionResult expected = null; // TODO: 初始化为适当的值
            ActionResult actual=null;
           //actual = target.Edit(id);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///GridPager 的测试
        ///</summary>
        [DeploymentItem("QzgfFrame.Mvc3.Tests\\test.csv"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\test.csv", "test#csv", DataAccessMethod.Sequential), TestMethod()]
        public void GridPagerTest()
        {
            string v_id = testContextInstance.DataRow["A"].ToString();
            //RoleController target = new RoleController(); // TODO: 初始化为适当的值
            int page = 0; // TODO: 初始化为适当的值
            int pagesize = 0; // TODO: 初始化为适当的值
            string sortname = string.Empty; // TODO: 初始化为适当的值
            string sortorder = string.Empty; // TODO: 初始化为适当的值
            string gridviewname = string.Empty; // TODO: 初始化为适当的值
            string gridsearch = string.Empty; // TODO: 初始化为适当的值
            string expected = string.Empty; // TODO: 初始化为适当的值
            string actual;
            //actual = roleController.GridPager(page, pagesize, sortname, sortorder, gridviewname, gridsearch);

            var da = new Yd170data();
            da.Accesstothebasestation = "123";
            da.Applyfax = "34";
            actual = JsonConvert.SerializeObject(da);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }


        /// <summary>
        ///Index 的测试
        ///</summary>
        [TestMethod()]
        public void IndexTest()
        {
            RoleController target = new RoleController(); // TODO: 初始化为适当的值
            ActionResult expected = null; // TODO: 初始化为适当的值
            ActionResult actual;
            actual = target.Index();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///roleFacade 的测试
        ///</summary>
        [TestMethod()]
        [DeploymentItem("QzgfFrame.Controllers.dll")]
        public void roleFacadeTest()
        {
            RoleController_Accessor target = new RoleController_Accessor(); // TODO: 初始化为适当的值
            RoleFacade expected = null; // TODO: 初始化为适当的值
            RoleFacade actual;
            target.roleFacade = expected;
            actual = target.roleFacade;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
    }
}
